<template>
   <div class="app-container">
      <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
         <el-form-item label="名称" prop="keyword">
            <el-input v-model="queryParams.keyword" placeholder="请输入名称" clearable style="width: 200px"
               @keyup.enter="handleQuery" />
         </el-form-item>
         <el-form-item label="系统" prop="systemId">
            <el-select v-model="queryParams.systemId" placeholder="所属系统" clearable style="width: 200px">
               <el-option
                  v-for="system in dataSystemOptions"
                  :key="system.id"
                  :label="system.name"
                  :value="system.id"
               />
            </el-select>
         </el-form-item>
         <el-form-item label="类型" prop="type">
            <el-select v-model="queryParams.type" placeholder="任务类型" clearable style="width: 200px">
               <el-option label="普通" :value="1" />
               <el-option label="定时" :value="2" />
               <el-option label="服务" :value="3" />
            </el-select>
         </el-form-item>
         <el-form-item label="任务状态" prop="status">
            <el-select v-model="queryParams.status" placeholder="任务状态" clearable style="width: 200px">
               <el-option label="启用" :value="1" />
               <el-option label="禁用" :value="0" />
            </el-select>
         </el-form-item>
         <el-form-item label="运行状态" prop="running">
            <el-select v-model="queryParams.running" placeholder="运行状态" clearable style="width: 200px">
               <el-option label="全部" :value="null" />
               <el-option label="运行中" :value="1" />
               <el-option label="未运行" :value="0" />
            </el-select>
         </el-form-item>
         <el-form-item>
            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
         </el-form-item>
      </el-form>

      <el-row :gutter="10" class="mb8">
         <el-col :span="1.5">
            <el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
         </el-col>
         <el-col :span="1.5">
            <el-button type="primary" plain icon="Delete" @click="handleDeleteBatch">删除</el-button>
         </el-col>
         <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>

      <el-table v-if="refreshTable" v-loading="loading" :data="menuList" row-key="menuId"
         :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
         @selection-change="handleSelectionChange">
         <el-table-column type="selection" :selectable="selectable" width="55" />
         <el-table-column prop="code" label="任务编码" width="160" show-overflow-tooltip></el-table-column>
         <el-table-column prop="name" label="任务名称" min-width="280" show-overflow-tooltip></el-table-column>
         <el-table-column prop="systemId" label="所属系统" width="150">
            <template #default="scope">{{ getSystemNameById(scope.row.systemId) }}</template>
         </el-table-column>
         <el-table-column label="类型" prop="type" width="80">
            <template #default="scope">
               <span v-if="scope.row.type === 1">普通</span>
               <span v-else-if="scope.row.type === 2">定时</span>
               <span v-else-if="scope.row.type === 3">服务</span>
               <span v-else>-</span>
            </template>
         </el-table-column>
         <el-table-column prop="cronJob" label="运行周期" width="120"></el-table-column>
         <el-table-column label="任务状态" prop="status" width="80">
            <template #default="scope">
               <el-switch
                  v-model="scope.row.status"
                  class="ml-2"
                  inline-prompt
                  style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
                  active-text="启用"
                  inactive-text="禁用"
                  :active-value="1"
                  :inactive-value="0"
                  @click="handleEnable(scope.row)"
               />
            </template>
         </el-table-column>
         <el-table-column label="运行状态" prop="running" width="85">
            <template #default="scope">
               <el-switch
                  v-if="[0, 1].includes(scope.row.running)"
                  v-model="scope.row.running"
                  class="ml-2"
                  inline-prompt
                  style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
                  active-text="运行中"
                  inactive-text="未运行"
                  :active-value="1"
                  :inactive-value="0"
                  @click="handleRunning(scope.row)"
               />
               <span v-else>-</span>
            </template>
         </el-table-column>
         <!-- <el-table-column prop="putInQueue" label="是否放入队列" width="120">
            <template #default="scope">
               <span v-if="scope.row.putInQueue === 1">是</span>
               <span v-else-if="scope.row.putInQueue === 0">否</span>
               <span v-else>-</span>
            </template>
         </el-table-column>
         <el-table-column prop="resend" label="异常是否重发" width="120">
            <template #default="scope">
               <span v-if="scope.row.resend === 1">是</span>
               <span v-else-if="scope.row.resend === 0">否</span>
               <span v-else>-</span>
            </template>
         </el-table-column>
         <el-table-column prop="maxResendNum" label="最大重发次数" width="120"></el-table-column> -->
         <el-table-column label="操作" width="280" fixed="right" class-name="small-padding fixed-width">
            <template #default="scope">
               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
               <el-button
                  v-if="scope.row.type === 1 && !scope.row.running"
                  link
                  type="primary"
                  icon="Setting"
                  @click="handleExec(scope.row.id)">
                  执行
               </el-button>
               <el-button link type="primary" icon="Notebook" @click="viewLog(scope.row.id)">日志</el-button>
            </template>
         </el-table-column>
      </el-table>
      <pagination
         v-show="total > 0"
         :total="total"
         v-model:page="queryParams.pageNum"
         v-model:limit="queryParams.pageSize"
         @pagination="getList"
      />
      <!-- 添加或修改 -->
      <el-dialog :title="title" v-model="open" width="680px" append-to-body>
         <el-form ref="editRef" :model="form" :rules="rules" label-width="100px">
            <el-row :gutter="10">
               <el-col :span="12">
                  <el-form-item label="任务类型" prop="type">
                     <el-select v-model="form.type" placeholder="任务类型" @change="getMissionPullOption('type')">
                        <el-option label="普通" :value="1" />
                        <el-option label="定时" :value="2" />
                        <el-option label="服务" :value="3" />
                     </el-select>
                  </el-form-item>
               </el-col>
               <el-col :span="12">
                  <el-form-item label="系统" prop="systemId">
                     <el-select v-model="form.systemId" placeholder="所属系统" @change="getMissionPullOption('id')">
                        <el-option
                           v-for="system in dataSystemOptions"
                           :key="system.id"
                           :label="system.name"
                           :value="system.id"
                        />
                     </el-select>
                  </el-form-item>
               </el-col>
               <el-col :span="12">
                  <el-form-item label="任务编码" prop="code">
                     <el-input v-model="form.code" placeholder="请输入任务编码" />
                  </el-form-item>
               </el-col>
               <el-col :span="12">
                  <el-form-item label="任务名称" prop="name">
                     <el-input v-model="form.name" placeholder="请输入任务名称" />
                  </el-form-item>
               </el-col>
               <el-col :span="24">
                  <el-form-item label="任务描述" prop="description">
                     <el-input type="textarea" resize="none" rows="4" v-model="form.description" placeholder="请输入任务描述" />
                  </el-form-item>
               </el-col>
               <el-col :span="24" v-if="form.type === 2">
                  <el-form-item label="运行周期表达式" prop="cronJob" label-width="auto">
                     <el-input v-model="form.cronJob" placeholder="请输入运行周期表达式" @click="openCronPopover" />
                  </el-form-item>
               </el-col>
               <el-col :span="12">
                  <el-form-item label="任务状态" prop="status">
                     <el-select v-model="form.status" placeholder="任务状态">
                        <el-option label="启用" :value="1" />
                        <el-option label="禁用" :value="0" />
                     </el-select>
                  </el-form-item>
               </el-col>
               <!-- <el-col :span="12">
                  <el-form-item label="是否放入队列" prop="putInQueue" label-width="110">
                     <el-select v-model="form.putInQueue" placeholder="是否放入队列">
                        <el-option label="是" :value="1" />
                        <el-option label="否" :value="0" />
                     </el-select>
                  </el-form-item>
               </el-col> -->
               <!-- <template v-if="[1, 2].includes(form.type)">
                  <el-col :span="12">
                     <el-form-item label="异常后是否重新发送" prop="resend">
                        <el-select v-model="form.resend" placeholder="是否重新发送">
                           <el-option label="是" :value="1" />
                           <el-option label="否" :value="0" />
                        </el-select>
                     </el-form-item>
                  </el-col>
                  <el-col :span="12">
                     <el-form-item label="最大重发次数" prop="maxResendNum" label-width="110">
                        <el-input-number
                           type="number"
                           :min="0"
                           controls-position="none"
                           :step="1"
                           step-strictly
                           v-model="form.maxResendNum"
                           placeholder="请输入最大重发次数"
                           style="width: auto;"
                        />
                     </el-form-item>
                  </el-col>
               </template> -->
            </el-row>
            <el-row class="edit-list header" :gutter="10">
               <el-col :span="4"></el-col>
               <el-col :span="8" style="text-align: center;">接口</el-col>
               <el-col :span="4" style="text-align: center;">状态</el-col>
               <el-col :span="5" style="text-align: center;">执行顺序</el-col>
               <el-col :span="2"></el-col>
            </el-row>
            <div class="list">
               <el-row class="edit-list content" :gutter="10" v-for="config, index in form.configs" :key="config.id ?? index">
                  <el-col :span="4">
                     <span v-if="index === 0" style="font-weight: bold; margin-bottom: 18px;">数据拉取配置</span>
                  </el-col>
                  <el-col :span="8">
                     <el-form-item :prop="'configs.' + index + '.configId'" :rules="rules.columnConfigId" style="width: 100%;">
                        <el-select v-model="config.configId" placeholder="请先选择任务类型和系统">
                           <el-option
                              v-for="pull in missionPullOptions"
                              :key="pull.id"
                              :label="pull.name"
                              :value="pull.id"
                           />
                        </el-select>
                     </el-form-item>
                  </el-col>
                  <el-col :span="4">
                     <el-form-item :prop="'configs.' + index + '.status'" :rules="rules.columnStatus" style="width: 100%;">
                        <el-select v-model="config.status" placeholder="状态">
                           <el-option label="启用" :value="1" />
                           <el-option label="禁用" :value="0" />
                        </el-select>
                     </el-form-item>
                  </el-col>
                  <el-col :span="5">
                     <el-form-item :prop="'configs.' + index + '.sort'" :rules="rules.columnSort">
                        <el-input-number
                           type="number"
                           :min="0"
                           controls-position="none"
                           :step="1"
                           step-strictly
                           v-model="config.sort"
                           placeholder="顺序"
                           style="width: auto;"
                        />
                     </el-form-item>
                  </el-col>
                  <el-col :span="2" style="justify-content: flex-start;" v-if="form.type !== 3">
                     <el-button
                        link
                        type="danger"
                        icon="Minus"
                        @click="toggleConfig('minus', index)"
                        style="margin-bottom: 18px;"
                     ></el-button>
                     <el-button
                        v-if="index === form.configs.length - 1"
                        link
                        type="primary"
                        icon="Plus"
                        @click="toggleConfig('add', index)"
                        style="margin-bottom: 18px;"
                     ></el-button>
                  </el-col>
               </el-row>
               <el-row class="edit-list content" :gutter="10" v-if="!form.configs?.length">
                  <el-col :span="4" style="font-weight: bold;">数据拉取配置</el-col>
                  <el-col :span="17" style="color: gray;">暂无数据</el-col>
                  <el-col :span="2" style="justify-content: flex-start;">
                     <el-button link type="primary" icon="Plus" @click="toggleConfig('add', 0)"></el-button>
                  </el-col>
               </el-row>
               <el-row>
                  <el-col :span="24">
                     <el-row class="edit-list header" :gutter="10">
                        <el-col :span="3"></el-col>
                        <el-col :span="6" style="text-align: center;">请求字段名</el-col>
                        <el-col :span="6" style="text-align: center;">取值参数名</el-col>
                        <el-col :span="6" style="text-align: center;">固定值</el-col>
                        <el-col :span="2"></el-col>
                     </el-row>
                     <div class="list">
                        <el-row class="edit-list content" :gutter="10" v-for="param, index in form.initParam" :key="index">
                           <el-col :span="3">
                              <span v-if="index === 0" style="font-weight: bold; margin-bottom: 18px;">初始参数</span>
                           </el-col>
                           <el-col :span="6">
                              <el-form-item :prop="'initParam.' + index + '.sourceField'" :rules="rules.columnSourceField">
                                 <el-input v-model="param.sourceField" placeholder="请输入请求字段名" />
                              </el-form-item>
                           </el-col>
                           <el-col :span="12">
                              <el-form-item
                                 :prop="'initParam.' + index + '.targetField'"
                                 :rules="[{
                                    validator: (rule, value, cb) => columnDataValidator(rule, value, cb, param) ,
                                    trigger: 'change'
                                 }]">
                                 <el-row :gutter="10">
                                    <el-col :span="12">
                                          <el-input v-model="param.targetField" placeholder="请输入取值参数名" />
                                    </el-col>
                                    <el-col :span="12">
                                          <el-input v-model="param.value" placeholder="默认值" />
                                    </el-col>
                                 </el-row>
                              </el-form-item>
                           </el-col>
                           <el-col :span="2" style="justify-content: flex-start;">
                              <el-button
                                 link
                                 type="danger"
                                 icon="Minus"
                                 @click="toggleParam('minus', index)"
                                 style="margin-bottom: 18px;"
                              ></el-button>
                              <el-button
                                 v-if="index === form.initParam.length - 1"
                                 link
                                 type="primary"
                                 icon="Plus"
                                 @click="toggleParam('add', index)"
                                 style="margin-bottom: 18px;"
                              ></el-button>
                           </el-col>
                        </el-row>
                        <el-row class="edit-list content" :gutter="10" v-if="!form.initParam?.length">
                           <el-col :span="3" style="font-weight: bold;">初始参数</el-col>
                           <el-col :span="18" style="color: gray;">暂无数据</el-col>
                           <el-col :span="2">
                              <el-button link type="primary" icon="Plus" @click="toggleParam('add', 0)"/>
                           </el-col>
                        </el-row>
                     </div>
                  </el-col>
               </el-row>
            </div>
         </el-form>
         <template #footer>
            <div class="dialog-footer">
               <el-button type="primary" @click="submitForm">确 定</el-button>
               <el-button @click="cancel">取 消</el-button>
            </div>
         </template>
      </el-dialog>

      <el-dialog v-model="showCronPopover">
         <Vue3CronPlusPicker @hide="closeCronPopover" @fill="cronValueFill" :expression="form.cronJob" :hideComponent="['year']"/>
		</el-dialog>

      <el-drawer
         v-model="drawer"
         title="任务日志"
         direction="rtl"
         width="80%"
         :before-close="hideLog"
      >
         <LogList v-if="drawer" :visible="drawer" :id="drawerTargetId" :failOnly="false" />
      </el-drawer>
   </div>
</template>

<script setup name="Mission">
import { ref, watch } from "vue";
import {
   missionUpdate,
   missionEnable,
   missionRunningStart,
   missionRunningStop,
   missionAdd,
   missionStop,
   missionStart,
   missionExec,
   missionGetListByPage,
   missionGetList,
   missionGetDetail,
   missionDelete,
   missionGetServerList,
   missionGetPullList
} from "@/api/mission";
import { dataSystemGetList } from "@/api/dataSystem";
import { pullGetList } from "@/api/pull";
import 'vue3-cron-plus-picker/style.css'
import { Vue3CronPlusPicker } from 'vue3-cron-plus-picker'
import LogList from './log.vue'

const { proxy } = getCurrentInstance();
const menuList = ref([]);
const open = ref(false);
const loading = ref(false);
const showSearch = ref(true);
const title = ref("");
const isExpandAll = ref(false);
const refreshTable = ref(true);
const total = ref(0);

const data = reactive({
   form: {
      id: null,
      systemId: null,
      type: null,
      code: null,
      name: null,
      description: null,
      status: null,
      cronJob: null,
      configs: []
   },
   queryParams: {
      pageNum: 1,
      pageSize: 10,
      systemId: null,
      type: null,
      status: null,
      keyword: null

   },
   detail: {},
   rules: {
      type: [{ required: true, message: "请选择任务类型", trigger: "change" }],
      systemId: [{ required: true, message: "请选择所属系统", trigger: "change" }],
      code: [{ required: true, message: "请输入编码", trigger: "change" }],
      name: [{ required: true, message: "请输入名称", trigger: "change" }],
      status: [{ required: true, message: "请选择任务状态", trigger: "change" }],
      putInQueue: [{ required: true, message: "请选择是否放入队列", trigger: "change" }],
      resend: [{ required: true, message: "请选择异常后是否重新发送", trigger: "change" }],
      maxResendNum: [{ required: true, message: "请输入最大重发次数", trigger: "change" }],
      columnConfigId: [{ required: true, message: "请选择接口", trigger: "change" }],
      columnStatus: [{ required: true, message: "请选择状态", trigger: "change" }],
      columnSort: [{ required: true, message: "请输入执行顺序", trigger: "change" }],
      columnSourceField: [{ required: true, message: "请输入请求字段名", trigger: "blur" }]
   },
});

// 取值参数和固定值至少填写一个
const columnDataValidator = (rule, value, callback, row) => {
   if(row.targetField || row.value){
      callback()
   }
   callback(new Error('请输入取值参数名或固定值'))
}

const { queryParams, form, detail, rules } = toRefs(data);
/** 查询系统列表 */
function getList() {
   loading.value = true;
   missionGetListByPage(queryParams.value).then(response => {
      menuList.value = response.data.records;
      total.value = response.data.total;
      loading.value = false;
   }).catch(()=> loading.value = false);
}

function getSystemNameById(id) {
   return dataSystemOptions.value.find(item => item.id === +id)?.name || '-'
}

const dataSystemOptions = ref([]);
/** 获取系统选项 */
function getDataSystemOption() {
   dataSystemGetList().then(response => {
      dataSystemOptions.value = response.data;
   });
}

const oldMissionType = ref(null);
const missionPullOptions = ref([]);

/** 获取服务接口选项 */
function getMissionPullOption(changeType) {
   if(changeType === 'type'){
      // 类型修改清空已选配置
      if(oldMissionType.value === 3 || form.value.type === 3){
         form.value.configs.forEach(e => e.configId = null)
      } else {
         oldMissionType.value = form.value.type
         return
      }
   }
   // 修改系统id清空已选配置
   if(changeType === 'id'){
      form.value.configs.forEach(e => e.configId = null)
   }
   // 服务类型只能有一条配置
   if(changeType === 'type' && form.value.type == 3){
      form.value.configs = [
         {
            configId: null,
            configType: 'PULL',
            status: null,
            sort: null
         }
      ]
   }
   // 拉取配置下拉数据
   if(form.value.type && form.value.systemId){
      if(form.value.type == 3){
         missionGetServerList({systemId: form.value.systemId}).then(response => {
            missionPullOptions.value = response.data || [];
         });
      } else {
         missionGetPullList({systemId: form.value.systemId}).then(response => {
            missionPullOptions.value = response.data || [];
            form.value.configs.map(e => {
               return {
                  ...e,
                  configId: null,
               }
            })
         });
      }
   } else {
      missionPullOptions.value = []
   }
}

// 新增删除初始参数
function toggleParam(type, index){
   const templateData = {
      sourceField: null,
      targetField: null,
      value: null
   }
   if(!form.value.initParam){
      form.value['initParam'] = []
   }
   if(type == 'minus'){
      form.value['initParam'].splice(index, 1)
   } else if(type == 'add'){
      form.value['initParam'].push(templateData)
   }
}

/** 取消按钮 */
function cancel() {
   open.value = false;
   reset();
}

/** 表单重置 */
function reset() {
   form.value = {
      id: null,
      code: null,
      type: null,
      systemId: null,
      name: null,
      description: null,
      cronJob: null,
      status: null,
      running: null,
      configs: [
         {
            configId: null,
            configType: 'PULL',
            status: null,
            sort: null
         }
      ]
   };
   editTargetId.value = null;
   proxy.resetForm("editRef");
   detail.value = {};
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

/** 新增按钮操作 */
function handleAdd() {
   reset();
   open.value = true;
   getDataSystemOption()
   title.value = "新增任务";
}

const editTargetId = ref(null)
/** 修改按钮操作 */
async function handleUpdate(row) {
   reset();
   editTargetId.value = row.id
   missionGetDetail({id: row.id}).then(response => {
      form.value = {
         id: response.data.id,
         code: response.data.code,
         type: response.data.type,
         systemId: +response.data.systemId,
         name: response.data.name,
         description: response.data.description,
         cronJob: response.data.cronJob,
         status: response.data.status,
         running: response.data.running,
         configs: response.data.relations.map(e => ({ ...e, configId: +e.configId })),
         initParam: response.data.initParam,
      };
      open.value = true;
      title.value = "修改任务";
      getMissionPullOption(null)
   });
   getDataSystemOption()
}

// 启用禁用
function handleEnable(row) {
   const { id, status } = row
   missionEnable({ id, status }).finally(() => {
      getList();
   });
}
// 运行未运行
function handleRunning(row) {
   const { id, running } = row
   if(running === 1){
      missionRunningStart({ id }).finally(() => {
         getList();
      });
   }
   if(running === 0){
      missionRunningStop({ id }).finally(() => {
         getList();
      });
   }
}
// 手动执行
function handleExec(id) {
   missionExec({id}).then(response => {
      proxy.$modal.msgSuccess("执行成功，请在日志中查看执行进度");
   })
}

// cron运行周期表达式弹窗
const showCronPopover = ref(false)
function openCronPopover(){
   showCronPopover.value = true
}
function closeCronPopover(){
   showCronPopover.value = false
}
function cronValueFill(cronValue){
   form.value.cronJob = cronValue
   form.value.cronJobFormat = cronValue ? cronValue.slice(0, -2) : null;
}

// 操作数据拉取配置
function toggleConfig(type, index){
   if(type == 'minus'){
      form.value.configs.splice(index, 1)
      proxy.$refs["editRef"].validate()
   }else if(type == 'add'){
      form.value.configs.push({
         configId: null,
         configType: 'PULL',
         status: null,
         sort: null
      })
   }
}

/** 提交按钮 */
function submitForm() {
   proxy.$refs["editRef"].validate(valid => {
      if (valid) {
         if (editTargetId.value) {
            missionUpdate({...form.value, cronJob: form.value.cronJobFormat, id: editTargetId.value}).then(response => {
               proxy.$modal.msgSuccess("修改成功");
               open.value = false;
               editTargetId.value = null;
               getList();
            });
            } else {
            missionAdd({ ...form.value, cronJob: form.value.cronJobFormat }).then(response => {
               proxy.$modal.msgSuccess("新增成功");
               open.value = false;
               getList();
            });
         }
      }
   });
}

/** 删除按钮操作 */
function handleDelete(row) {
   proxy.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function () {
      return missionDelete({ ids: row.id });
   }).then(() => {
      getList();
      proxy.$modal.msgSuccess("删除成功");
   }).catch(() => { });
}

const selectedList = ref([])
function handleSelectionChange(list) {
   selectedList.value = list
}

/** 多选删除操作 */
function handleDeleteBatch() {
   if (selectedList.value.length) {
      proxy.$modal.confirm('是否确认删除选中的' + selectedList.value.length + '个数据?').then(function () {
         const ids = selectedList.value.map(item => item.id).join(',');
         return missionDelete({ ids });
      }).then(() => {
         getList();
         proxy.$modal.msgSuccess("删除成功");
      }).catch(() => { });
   } else {
      proxy.$modal.msgError("请选择要删除的数据");
   }
}

// 日志抽屉
const drawer = ref(false);
const drawerTargetId = ref(null);
function viewLog(id) {
   drawerTargetId.value = id;
   drawer.value = true;
}
function hideLog() {
   drawerTargetId.value = null;
   drawer.value = false;
}

getList();
getDataSystemOption();
</script>
<style lang='scss' scoped>
.list{
   width: 100%;
   :deep(.el-form-item__content){
      margin-left: 0 !important;
      .el-row{
         width: 100%;
      }
   }
}
:deep(.el-row.edit-list){
   > .el-col{
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: center;
   }
}
:deep(.el-drawer){
   width: 60% !important;
   .el-drawer__header{
      margin-bottom: 0;
   }
}
</style>
